package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UdpDictServer extends UdpEchoServer{
    private HashMap<String, String> dict = new HashMap<>();
    public UdpDictServer(int port) throws SocketException {

        super(port);

        dict.put("cat", "猫");
        dict.put("fish", "鱼");
        dict.put("dog", "狗");
        dict.put("小米", "su7");
        dict.put("乖乖", "无敌可爱小猫");
    }

    public String process(String request) {
        return dict.getOrDefault(request, "词典未收录");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer dictServer = new UdpDictServer(9090);
        dictServer.start();
    }


}
